#ifndef DETECTTHREAD_H
#define DETECTTHREAD_H

#include <QObject>
#include <QThread>
#include <QRunnable>
#include "threadsafequeue.h"

#include "commons.h"
#include "inference.h"

// Cpp native
#include <fstream>
#include <vector>
#include <string>
#include <random>

// OpenCV / DNN / Inference
#include <opencv2/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/dnn.hpp>

class DetectThread: public QThread
{
    Q_OBJECT
public:
    DetectThread(QObject* parent = nullptr);
    const int VideofileDetectThreadID = 2;
    const int CameraDetectThreadID = 3;

     bool STOP;
     int ID;
     bool islabel=false;
     bool RunWithCuda=false;
     float iou_thres;
     float conf_thres;
     QString path;
     std::shared_ptr<Inference> inference;// 推理模型
     cv::Size input_shape;

    virtual void stop();

    virtual void do_detect() = 0;
    virtual int get_detect_id() = 0;
    virtual void run() override;
    virtual void before_running();
    virtual void after_running();
    virtual void clear();
};

#endif // DETECTTHREAD_H
